/******************************************************************************************
 * Import
 ******************************************************************************************/

// module
import React, {Component} from 'react';
import {Dimensions} from 'react-native';
import { Icon, Toast } from 'antd-mobile-rn';

// project
import {
    Page, Content, Header, Row, Between, Hand, ItemY, Text, Image, TouchOpacity
} from '../../../library';
import HttpTemp from '../../../preset/func/http/httptemp';


/******************************************************************************************
 * Export
 ******************************************************************************************/

export default class PersonalData extends Component {

    /*------------------------------------------------------------------------------------
	 * 初始化
	 *-----------------------------------------------------------------------------------*/
    constructor(props) {
        super(props);
        this.Nav = this.props.navigation;

        /**
         * state
         */
        this.state = {
            id:1,
            phone:'15713028819',
            headImage:'123'
        };
    }


    /*------------------------------------------------------------------------------------
	 * 生命周期
	 *-----------------------------------------------------------------------------------*/
    componentDidMount() {
        // SplashScreen.hide();
        
        HttpTemp.get({
            url:'/page/user/detail.php',
            success:(res)=>{
                this.setState({
                    headImage:res.data.object.set_head,
                    phone:res.data.set_mobile,
                    id:res.data.id
                })
                console.log('res++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++',res)
                console.log('this.state++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++',this.state)
            }
        })
    }


    /*------------------------------------------------------------------------------------
	 * 渲染
	 *-----------------------------------------------------------------------------------*/
    render(){
        var windowWidth = Dimensions.get('window').width;
        return(
            <Page>

                <Content bg='#efeff4' mt='48'>
                    <TouchOpacity df active={0.6} onPress={(e)=> {
                        Toast.info('此功能暂未开启');
                    }}>
                        <Between bg='#fff' py='10' h='58' y='center' mt='8' mb='5' pa='10'>
                            <Hand w='46' h='46' ra='23' oh>
                                <Image source={{uri:this.state.headImage}} w='46' h='46' ra='23' resizeMode='cover' style={{backgroundColor:'#efeff4'}}></Image>
                            </Hand>
                            <Hand><Text color='#c9c9c9' size='13'>上传照片</Text></Hand>
                        </Between>
                    </TouchOpacity>

                    <Row my='5'>
                        <ItemY f='1'>
                            <TouchOpacity w={windowWidth} active={0.6} onPress={(e)=> {
                                // 
                                // 
                                // 
                            }}>
                                <Between pa='15' h='43' bb='solid 1 #f0f0f0' bg='#fff' f='1'>
                                    <Hand x='left' y='center'>
                                        <Text color='#333'>昵称</Text>
                                    </Hand>
                                    <Hand x='right' y='center'>
                                        <Text color='#aeaeae' size='13'>{this.state.phone}</Text>
                                        <Icon type='right' size='xxs' color='#b2b2b2'></Icon>
                                    </Hand>
                                </Between>
                            </TouchOpacity>
                            <TouchOpacity w={windowWidth} active={0.6} onPress={(e)=> {
                                this.Nav.navigate('UserSettingConfirm')
                            }}>
                                <Between pa='15' h='43' bb='solid 1 #f0f0f0' bg='#fff' f='1'>
                                    <Hand x='left' y='center'>
                                        <Text color='#333'>实名认证</Text>
                                    </Hand>
                                    <Hand x='right' y='center'>
                                        {/* <Text color='#aeaeae' size='13'>未验证</Text> */}
                                        <Icon type='right' size='xxs' color='#b2b2b2'></Icon>
                                    </Hand>
                                </Between>
                            </TouchOpacity>
                            <TouchOpacity w={windowWidth} active={0.6} onPress={(e)=> {
                                this.Nav.navigate('UserSettingAddress')
                            }}>
                                <Between pa='15' h='43' bb='solid 1 #f0f0f0' bg='#fff' f='1'>
                                    <Hand x='left' y='center'>
                                        <Text color='#333'>收货地址</Text>
                                    </Hand>
                                    <Hand x='right' y='center'>
                                        <Icon type='right' size='xxs' color='#b2b2b2'></Icon>
                                    </Hand>
                                </Between>
                            </TouchOpacity>
                        </ItemY>
                    </Row>
                    <Row my='5'>
                        <ItemY f='1'>
                            <TouchOpacity w={windowWidth} active={0.6} onPress={(e)=> {
                                this.Nav.navigate('UserSettingHouse')
                            }}>
                                <Between pa='15' h='43' bb='solid 1 #f0f0f0' bg='#fff' f='1'>
                                    <Hand x='left' y='center'>
                                        <Text color='#333'>我的房屋</Text>
                                    </Hand>
                                    <Hand x='right' y='center'>
                                        <Icon type='right' size='xxs' color='#b2b2b2'></Icon>
                                    </Hand>
                                </Between>
                            </TouchOpacity>
                            <TouchOpacity w={windowWidth} active={0.6} onPress={(e)=> {
                                this.Nav.navigate('UserSettingCar')
                            }}>
                                <Between pa='15' h='43' bb='solid 1 #f0f0f0' bg='#fff' f='1'>
                                    <Hand x='left' y='center'>
                                        <Text color='#333'>我的车辆</Text>
                                    </Hand>
                                    <Hand x='right' y='center'>
                                        <Icon type='right' size='xxs' color='#b2b2b2'></Icon>
                                    </Hand>
                                </Between>
                            </TouchOpacity>
                        </ItemY>
                    </Row>
                    <Row my='5'>
                        <ItemY f='1'>
                            <TouchOpacity w={windowWidth} active={0.6}>
                                <Between pa='15' h='43' bb='solid 1 #f0f0f0' bg='#fff' f='1'>
                                    <Hand x='left' y='center'>
                                        <Text color='#333'>手机号码</Text>
                                    </Hand>
                                    <Hand x='right' y='center'>
                                        <Text color='#aeaeae' size='13'>{this.state.phone.substring(0,3)+'****'+this.state.phone.substring(7,11)}</Text>
                                    </Hand>
                                </Between>
                            </TouchOpacity>
                            <TouchOpacity w={windowWidth} active={0.6} onPress={(e)=> {
                                Toast.info('此功能暂未开启');
                            }}>
                                <Between pa='15' h='43' bb='solid 1 #f0f0f0' bg='#fff' f='1'>
                                    <Hand x='left' y='center'>
                                        <Text color='#333'>修改密码</Text>
                                    </Hand>
                                    <Hand x='right' y='center'>
                                        <Icon type='right' size='xxs' color='#b2b2b2'></Icon>
                                    </Hand>
                                </Between>
                            </TouchOpacity>
                            <TouchOpacity w={windowWidth} active={0.6} onPress={(e)=> {
                                Toast.info('此功能暂未开启');
                            }}>
                                <Between pa='15' h='43' bb='solid 1 #f0f0f0' bg='#fff' f='1'>
                                    <Hand x='left' y='center'>
                                        <Text color='#333'>设置支付密码</Text>
                                    </Hand>
                                    <Hand x='right' y='center'>
                                        <Icon type='right' size='xxs' color='#b2b2b2'></Icon>
                                    </Hand>
                                </Between>
                            </TouchOpacity>
                        </ItemY>
                    </Row>
                    

                </Content>

                {/* 顶部 star */}
                <Header h='48' y='center' bg='#fff'>
                    <Between px='10'>
                            

                        <TouchOpacity active={0.6} onPress={(e)=> {
                            this.Nav.goBack()
                        }}>
                            <Icon type='left' size='md' color='#00CC66' />
                        </TouchOpacity>

                        <Text size='17'>个人资料</Text>
                        <Text></Text>
                    </Between>
                </Header>
                {/* 顶部 star */}

            </Page>
        )
    }
}
